package com.lepu.app.fun.chat.fragment;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.app.utils.Const;
import com.app.utils.LoginUtil;
import com.eyzhs.app.R;
import com.lepu.app.fun.chat.bean.ChatSession;
import com.lepu.app.fun.chat.business.uiflow.UITransition;
import com.lepu.app.fun.chat.controller.base.BaseChattingFragment;
import com.lepu.app.usercenter.UserInfoActivity;

import common.db.Constants;

/**
 * Created by changliu on 2015/01/27.
 * <p/>
 */
@SuppressLint("NewApi")
public class ChattingFragment extends BaseChattingFragment implements View.OnClickListener {

    public String doctorID;
    private View mView;
    private ImageView mImageViewClosed;
    private RelativeLayout mRl_yellow_window;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    protected View inflateView(LayoutInflater inflater, ViewGroup container) {
        mView = inflater.inflate(R.layout.chat_fragment, container, false);
        mImageViewClosed = (ImageView) mView.findViewById(R.id.iv_close);
        mRl_yellow_window = (RelativeLayout) mView.findViewById(R.id.rl_yellow_window);
        //新的流程还没有确认

        return mView;
    }

    /**
     * 初始化布局的
     */
    private void initView() {
        mRl_yellow_window.setVisibility(View.VISIBLE);
        mImageViewClosed.setOnClickListener(this);
    }

    @Override
    public void gotoOtherProfile(String userid) {
        // todo 跳转到医生详情
    }

    @Override
    protected void gotoMineProfile() {
        startActivity(new Intent(getActivity(), UserInfoActivity.class));
        UITransition.setActivityStartRightIn(getActivity());
    }

    @Override
    protected void initExtra() {
        super.initExtra();
        if (!mFromHistory) {
            initView();
        } else {
            if (mRl_yellow_window != null)
                mRl_yellow_window.setVisibility(View.GONE);
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.iv_close:
                mRl_yellow_window.setVisibility(View.GONE);
                break;
            default:
                break;
        }
    }
}
